3.6.28 \(\int \cos ^3(c+d x) (a+b \tan (c+d x))^2 \, dx\) [528]

Optimal. Leaf size=90 \[ -\frac {a b \cos ^3(c+d x)}{6 d}+\frac {\left (2 a^2+b^2\right ) \sin (c+d x)}{2 d}-\frac {\left (2 a^2+b^2\right ) \sin ^3(c+d x)}{6 d}-\frac {b \cos ^3(c+d x) (a+b \tan (c+d x))}{2 d} \]

[Out]

-1/6*a*b*cos(d*x+c)^3/d+1/2*(2*a^2+b^2)*sin(d*x+c)/d-1/6*(2*a^2+b^2)*sin(d*x+c)^3/d-1/2*b*cos(d*x+c)^3*(a+b*ta
n(d*x+c))/d

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3589, 3567, 2713} \begin {gather*} -\frac {\left (2 a^2+b^2\right ) \sin ^3(c+d x)}{6 d}+\frac {\left (2 a^2+b^2\right ) \sin (c+d x)}{2 d}-\frac {a b \cos ^3(c+d x)}{6 d}-\frac {b \cos ^3(c+d x) (a+b \tan (c+d x))}{2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^3*(a + b*Tan[c + d*x])^2,x]

[Out]

-1/6*(a*b*Cos[c + d*x]^3)/d + ((2*a^2 + b^2)*Sin[c + d*x])/(2*d) - ((2*a^2 + b^2)*Sin[c + d*x]^3)/(6*d) - (b*C
os[c + d*x]^3*(a + b*Tan[c + d*x]))/(2*d)

Rule 2713

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rule 3567

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*((d*Sec[
e + f*x])^m/(f*m)), x] + Dist[a, Int[(d*Sec[e + f*x])^m, x], x] /; FreeQ[{a, b, d, e, f, m}, x] && (IntegerQ[2
*m] || NeQ[a^2 + b^2, 0])

Rule 3589

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[b*(d*Sec
[e + f*x])^m*((a + b*Tan[e + f*x])/(f*(m + 1))), x] + Dist[1/(m + 1), Int[(d*Sec[e + f*x])^m*(a^2*(m + 1) - b^
2 + a*b*(m + 2)*Tan[e + f*x]), x], x] /; FreeQ[{a, b, d, e, f, m}, x] && NeQ[a^2 + b^2, 0] && NeQ[m, -1]

Rubi steps

\begin {align*} \int \cos ^3(c+d x) (a+b \tan (c+d x))^2 \, dx &=-\frac {b \cos ^3(c+d x) (a+b \tan (c+d x))}{2 d}-\frac {1}{2} \int \cos ^3(c+d x) \left (-2 a^2-b^2-a b \tan (c+d x)\right ) \, dx\\ &=-\frac {a b \cos ^3(c+d x)}{6 d}-\frac {b \cos ^3(c+d x) (a+b \tan (c+d x))}{2 d}-\frac {1}{2} \left (-2 a^2-b^2\right ) \int \cos ^3(c+d x) \, dx\\ &=-\frac {a b \cos ^3(c+d x)}{6 d}-\frac {b \cos ^3(c+d x) (a+b \tan (c+d x))}{2 d}-\frac {\left (2 a^2+b^2\right ) \text {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{2 d}\\ &=-\frac {a b \cos ^3(c+d x)}{6 d}+\frac {\left (2 a^2+b^2\right ) \sin (c+d x)}{2 d}-\frac {\left (2 a^2+b^2\right ) \sin ^3(c+d x)}{6 d}-\frac {b \cos ^3(c+d x) (a+b \tan (c+d x))}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.51, size = 64, normalized size = 0.71 \begin {gather*} \frac {-3 a b \cos (c+d x)-a b \cos (3 (c+d x))+\left (5 a^2+b^2+\left (a^2-b^2\right ) \cos (2 (c+d x))\right ) \sin (c+d x)}{6 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^3*(a + b*Tan[c + d*x])^2,x]

[Out]

(-3*a*b*Cos[c + d*x] - a*b*Cos[3*(c + d*x)] + (5*a^2 + b^2 + (a^2 - b^2)*Cos[2*(c + d*x)])*Sin[c + d*x])/(6*d)

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 52, normalized size = 0.58

method result size
derivativedivides \(\frac {\frac {b^{2} \left (\sin ^{3}\left (d x +c \right )\right )}{3}-\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3}+\frac {a^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}}{d}\) \(52\)
default \(\frac {\frac {b^{2} \left (\sin ^{3}\left (d x +c \right )\right )}{3}-\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3}+\frac {a^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}}{d}\) \(52\)
risch \(-\frac {a b \cos \left (d x +c \right )}{2 d}+\frac {3 a^{2} \sin \left (d x +c \right )}{4 d}+\frac {b^{2} \sin \left (d x +c \right )}{4 d}-\frac {a b \cos \left (3 d x +3 c \right )}{6 d}+\frac {\sin \left (3 d x +3 c \right ) a^{2}}{12 d}-\frac {\sin \left (3 d x +3 c \right ) b^{2}}{12 d}\) \(93\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^3*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(1/3*b^2*sin(d*x+c)^3-2/3*a*b*cos(d*x+c)^3+1/3*a^2*(cos(d*x+c)^2+2)*sin(d*x+c))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 52, normalized size = 0.58 \begin {gather*} -\frac {2 \, a b \cos \left (d x + c\right )^{3} - b^{2} \sin \left (d x + c\right )^{3} + {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} a^{2}}{3 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^3*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/3*(2*a*b*cos(d*x + c)^3 - b^2*sin(d*x + c)^3 + (sin(d*x + c)^3 - 3*sin(d*x + c))*a^2)/d

________________________________________________________________________________________

Fricas [A]
time = 0.41, size = 53, normalized size = 0.59 \begin {gather*} -\frac {2 \, a b \cos \left (d x + c\right )^{3} - {\left ({\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, a^{2} + b^{2}\right )} \sin \left (d x + c\right )}{3 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^3*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/3*(2*a*b*cos(d*x + c)^3 - ((a^2 - b^2)*cos(d*x + c)^2 + 2*a^2 + b^2)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \cos ^{3}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**3*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*cos(c + d*x)**3, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 11162 vs. \(2 (82) = 164\).
time = 18.11, size = 11162, normalized size = 124.02 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^3*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/48*(3*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*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an(1/2*c)^2 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^
2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^6*tan(1/2*c)^4 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2
+ 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 + 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c
)^2 + 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^4*tan(1/2
*c)^6 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2
 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*
c)^2 - 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^4*tan(1/2*c)^6 - 6*a*b*arctan((tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x)
- tan(1/2*c) + 1)/(tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) + tan(1/2*c) + 1))*tan(1/2*d*x)^6*tan(1/2*c)^6 - 6*a
*b*arctan((tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) + tan(1/2*c) + 1)/(tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) -
tan(1/2*c) + 1))*tan(1/2*d*x)^6*tan(1/2*c)^6 + 6*a*b*arctan((tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) + tan(1/2*
c) - 1)/(tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) - tan(1/2*c) - 1))*tan(1/2*d*x)^6*tan(1/2*c)^6 + 6*a*b*arctan(
(tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) - tan(1/2*c) - 1)/(tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) + tan(1/2*c)
 - 1))*tan(1/2*d*x)^6*tan(1/2*c)^6 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) +
tan(1/2*d*x)^2 - tan(1/2*c)^2 + 2*tan(1/2*c) - 1)*tan(1/2*d*x)^6*tan(1/2*c)^4 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*ta
n(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 - 2*tan(1/2*c) - 1)*tan(1/2*d*x)^6*ta
n(1/2*c)^4 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2
*c)^2 + 2*tan(1/2*c) - 1)*tan(1/2*d*x)^4*tan(1/2*c)^6 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d
*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 - 2*tan(1/2*c) - 1)*tan(1/2*d*x)^4*tan(1/2*c)^6 + 32*a*b*tan(
1/2*d*x)^6*tan(1/2*c)^6 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x
)^2 - tan(1/2*c)^2 + 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2
*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^6*tan(1/2*c)^2 + 9*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2
*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan
(1/2*c)^2 - 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^6*t
an(1/2*c)^2 + 27*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1
/2*c)^2 + 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + t
an(1/2*c)^2 + 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^4*tan(1/2*c)^4 + 27*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*
tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2
- 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^4*tan(1/2*c)^
4 - 18*a*b*arctan((tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) - tan(1/2*c) + 1)/(tan(1/2*d*x)*tan(1/2*c) - tan(1/2
*d*x) + tan(1/2*c) + 1))*tan(1/2*d*x)^6*tan(1/2*c)^4 - 18*a*b*arctan((tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) +
 tan(1/2*c) + 1)/(tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) - tan(1/2*c) + 1))*tan(1/2*d*x)^6*tan(1/2*c)^4 + 18*a
*b*arctan((tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) + tan(1/2*c) - 1)/(tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) -
tan(1/2*c) - 1))*tan(1/2*d*x)^6*tan(1/2*c)^4 + 18*a*b*arctan((tan(1/2*d*x)*tan(1/2*c) - tan(1/2*d*x) - tan(1/2
*c) - 1)/(tan(1/2*d*x)*tan(1/2*c) + tan(1/2*d*x) + tan(1/2*c) - 1))*tan(1/2*d*x)^6*tan(1/2*c)^4 + 96*a^2*tan(1
/2*d*x)^6*tan(1/2*c)^5 + 9*pi*a*b*sgn(tan(1/2*d...

________________________________________________________________________________________

Mupad [B]
time = 3.76, size = 77, normalized size = 0.86 \begin {gather*} \frac {2\,\left (\frac {\sin \left (c+d\,x\right )\,a^2\,{\cos \left (c+d\,x\right )}^2}{2}+\sin \left (c+d\,x\right )\,a^2-a\,b\,{\cos \left (c+d\,x\right )}^3-\frac {\sin \left (c+d\,x\right )\,b^2\,{\cos \left (c+d\,x\right )}^2}{2}+\frac {\sin \left (c+d\,x\right )\,b^2}{2}\right )}{3\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^3*(a + b*tan(c + d*x))^2,x)

[Out]

(2*(a^2*sin(c + d*x) + (b^2*sin(c + d*x))/2 + (a^2*cos(c + d*x)^2*sin(c + d*x))/2 - (b^2*cos(c + d*x)^2*sin(c
+ d*x))/2 - a*b*cos(c + d*x)^3))/(3*d)

________________________________________________________________________________________